
# stores player info, especially inventory
class Player:
    def __init__(self):
        self.inventory = {}
        self.cash = 30
        self.cookiepoints = 0
    
    # adds item to the inventory for this player
    def add_item(self,item):        
        self.inventory[item.get_id()] = item
        return
    
    # remove and return item from inventory (if it is there)
    # otherwise return empty string
    def pop_item(self,item_id):        
        return self.inventory.pop(item_id,'')
    
    # update the cash status of the player
    def update_cash(self,amt,opr):
        if opr == 'credit':
            self.cash += int(amt)
        else:
            self.cash -= int(amt)
        return
    
    # update the cookie point status of the player
    def update_cookiepts(self,pts,opr):
        if opr == 'credit':
            self.cookiepoints += int(pts)
        else :
            self.cookiepoints -= int(pts)
        return
        
        